package com.cl.util;


import java.io.Serializable;
import java.util.List;
/**
 * 
 * @author chenlu
 * @date 2017-9-13 下午4:35:13
 */
public class Pager<T> implements Serializable{

	private static final long serialVersionUID = 505708287117618716L;
	private int pageSize = 20; // 每页显示记录数
	private int page = 1; // 当前页
	private int pages = 0; //总共页数
	private int totleCount = 0;//总多少条记录

	private List<T> list;
	
	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public int getPageSize() {
		return pageSize;
	}

	public int getPage() {
		return page;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPages() {
		return pages;
	}

	public void setPages(int pages) {
		this.pages = pages;
	}

	public int getTotleCount() {
		return totleCount;
	}

	public void setTotleCount(int totleCount) {
		this.totleCount = totleCount;
	}

	public static int getPages(int size, int pageSize) {
        if (pageSize < 1)
            return 0;
        int pages = (size % pageSize == 0) ? (size / pageSize)
                : ((size / pageSize) + 1);
        return pages;
    }
}
